# -*- coding: utf-8 -*-

# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html

import scrapy


class DemoItem(scrapy.Item):
    # define the fields for your item here like:
    # name = scrapy.Field()
    pass

class Qiancheng(scrapy.Item):
    title = scrapy.Field()  # 标题
    url = scrapy.Field()  # 详情链接
    slary = scrapy.Field()  # 薪资
    area = scrapy.Field()  # 区域
    exp = scrapy.Field()  # 经验
    edu = scrapy.Field()  # 学历
    ptype = scrapy.Field()  # 职业类型
    date_pub = scrapy.Field()  # 发布时间
    advantage = scrapy.Field()  # 职位诱惑
    jobdesc = scrapy.Field()  # 岗位详情
    jobaddr = scrapy.Field()  # 工作地点
    company = scrapy.Field()  # 公司
    crawl_time = scrapy.Field()  # 爬取时间


# 前程无忧数据库储存
    def get_sql(self):
        sql = 'insert into qiancheng(url,title,slary,area,exp,date_pub,advantage,ptype,jobdesc,company,edu,jobaddr,crawl_time)value ' \
              '(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)'
        data = (self['url'],self['title'],self['slary'],self['area'],self['exp'],self['date_pub'],self['advantage'],self['ptype'],self['jobdesc'],self['company'],self['edu'],self['jobaddr'],self['crawl_time'])

        return sql,data


